/*
 * =====================================================================================
 *
 *       Filename:  conv.h
 *
 *    Description:  Used as convertion tool
 *
 *        Version:  1.0
 *        Created:  06/01/2012 09:50:40 AM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  Liu XiaoFei (), 
 *        Company:  
 *
 * =====================================================================================
 */
#ifndef     _CONVERTION_TOOL_HEADER_
#define     _CONVERTION_TOOL_HEADER_
#include    <sstream>

namespace util
{
    namespace conv
    {
        template <typename D, typename S>
            D conv(const S &source);
    }
}

template <typename D, typename S>
D util::conv::conv(const S &source)
{
    std::stringstream temp;
    temp << source;
    D d;
    temp >> d;
    return d;
}

#endif  //_CONVERTION_TOOL_HEADER_
